<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>

<script>
	var client=function(){
		var engine={
			//呈现引擎
			ie:0,
			gecko:0,
			webkit:0,
			khtml:0,
			opera:0,
			//具体的版本
			ver:null	
		};	
		
		var browser={
			//浏览器
			ie:0,
			firefox:0,
			safari:0,
			konq:0,
			opera:0,
			chrome:0,
			
			//具体的版本
			ver:null	
		};
		
		//在此检测呈现引擎、平台、和设备
		return {
			engine:engine,
			browser:browser	
		}
	}();
	
	//检测呈现引擎及浏览器
	var ua=navigator.userAgent;
	
	if(window.opera){
		engine.ver=browser.ver=window.opera.version();
		engine.opera=browser.opera=parseFloat(engine.ver);	
	}else if(/AppleWebkit\/(\S+)/.test(ua)){
		engine.ver=RegExp['$1'];
		engine.webkit=parseFloat(engine.ver);	
		
		//确定是chrome还是safari
		if(/Chrome\/(\S+)/.test(ua)){
			browser.ver = RegExp['$1']	;
			browser.chrome = parseFloat(browser.ver);
		}else if(/Version\/(\S+)/.test(ua)){
			browser.ver = RegExp['$1'];
			browser.safari = parseFloat(browser.ver);
		}else{
			//近似的确定版本号
			var safariVersion = 1;
			
			if(engine.webkit < 100){
				safariVersion = 1;	
			}else if(engine.webkit < 312){
				safariVersion = 1.2;
			}else if(engine.webkit < 412){
				safariVersion = 1.3;
			}else {
				safariVersion=2;
			}
			browser.safari = browser.ver = safariVersion;
		};
	}else if(/KHTML\/(\S+)/.test(ua) || /Konqueror\/([^;]+)/.test(ua)){
		engine.ver = browser.ver = RegExp['$1'];	
		engine.KHTML = browser.konq = parseFloat(engine.ver);
	}else if(/rv:([^\)]+)\) Gecko\/\d{8}/.test(ua)){
		engine.ver=RegExp['$1'];
		engine.gecko=parseFloat(engine.ver);	
		
		//确定是不是Firefox
		if(/Firefox\/(\S+)/.test(ua)){
			browser.ver = RegExp['$1']	;
			browser.firefox = parseFloat(browser.ver);
		}
	}else if(/MSIE ([^;]+)/.test(ua)){
		engine.ver = browser.ver = RegExp['$1'];	
		engine.ie = browser.ie = parseFloat(engine.ver);	
	};
	
	if(client.engine.webkit){
		if(client.browser.chrome){
			
		}else if(client.browser.dafari){
			
		}	
	}else if(client.engine.gecko){
		if(client.browser.firefox){
			
		}else{
				
		}	
	}
</script>
	


</head>

<body>
    <div id="dom">8888888</div>
</body>

</html>
 